package com.smh.a06TCPDemo2;

import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws IOException {
        //TCP协议

        //链接不上就会报错
        Socket socket = new Socket("127.0.0.1", 10001);

        OutputStream os = socket.getOutputStream();
        OutputStreamWriter osw = new OutputStreamWriter(os);
        osw.write("你好".toCharArray());
        osw.close();
        socket.close();

    }
}
